home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5933 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: pegasus.montclair.edu!harmon
  2. From: harmon@pegasus.montclair.edu (Derek Harmon)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Array pointing to Dynamic list thingie
  5. Date: 18 Feb 1996 17:30:01 -0500
  6. Organization: Montclair State University
  7. Message-ID: <harmon.824682149@pegasus.montclair.edu>
  8. References: <4g2qag$pmb@wariat.wariat.org>
  9. NNTP-Posting-Host: pegasus.montclair.edu
  10. X-Newsreader: NN version 6.5.0 #68 (NOV)
  11.  
  12. balif@nacs.net (balif) writes:
  13.  
  14. >for (i=1;i<10;++i)
  15. > printf("Skill: %d/n",trainer_mob[3][i]);
  16. >would print out a list of skills that trainer mob 3 has. But I do not know 
  17. >how long that list will be. I want something where I can say like
  18.  
  19. Try using 0 (or an arbitrary int which is not a valid skill) to terminate
  20. the list of skills that can be trained.  Then use a while loop as follows,
  21.  
  22. : i=0;
  23. : trn=3;
  24. : while (trainer_mob[trn][i] != 0) {
  25. :   printf("Skill: %d\n", trainer_mob[trn][i]);
  26. :   i++;
  27. : }
  28.  
  29.                                               -- Stone
  30. --
  31. # Derek Harmon (aka Stonelight)    harmon@pegasus.montclair.edu
  32. # - Computer Science Undergrad, Montclair State University, NJ
  33. # - My views are my own, nobody else is this creative.  3;)>
  34. ... Without C we would be programming in BASI, PASAL, and OBOL.
  35.  
  36.